<template>
  <div>
      <el-dropdown  @command="handleCommand" trigger="click">
 
 <svg-icon icon-class="multilingual" />
 
  <el-dropdown-menu slot="dropdown">
    <el-dropdown-item command='zh'>中文</el-dropdown-item>
    <el-dropdown-item command='en'>英语</el-dropdown-item>
    <el-dropdown-item command='tw'> 繁体</el-dropdown-item>
 
  </el-dropdown-menu>
</el-dropdown>
    
   
      
  </div>
</template>

<script>
import Cookie from 'js-cookie'
export default {
  name: 'RuoYilangs',
  data() {
    return {
     
    }
  },
  created(){
      this.initlangs()//初始化语言
  },
  methods: {
      initlangs(){
          if(  Cookie.get('langs')){
              this.$i18n.locale = Cookie.get('langs')
          }
      },
    handleCommand(command) {
          console.log(command)
        this.$i18n.locale = command;
        Cookie.set('langs',command)
      
      
    }
  }
}
</script>
